package com.hh.game.service.hall.service;

import com.hh.game.service.hall.domain.User;

public class UserServiceStub implements UserService {
    private final UserService service;
    ThreadLocal<String> threadLocal = new ThreadLocal();

    public UserServiceStub(UserService service) {
        this.service = service;
    }

    @Override
    public User update(User user) {
        return service.update(user);
    }

    @Override
    public String echoName(String name, User user) {
        System.out.println("----------------");
        return service.echoName(name ,user);
    }

    @Override
    public String echoName(String name, User user, int id) {
        if(id == 0){
            threadLocal.set(name);
            System.out.println("----------------");
        }else {
            System.out.println("----------------" + threadLocal.get());
        }
        return service.echoName(name ,user ,id + 1);
    }

    @Override
    public void noticeUser(int userId, String msg) {
        service.noticeUser(userId ,msg);
    }

    @Override
    public void broadcastUser(String msg) {
        service.broadcastUser(msg);
    }
}
